#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QDebug>
#include <QTimer>
#include <QVideoWidget>
#include <QMediaPlayer>
#include <QTcpServer>
#include <QTcpSocket>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void keyPressEvent(QKeyEvent *event) override;
    void keyReleaseEvent(QKeyEvent *event) override;
    void getLocalIPAddresses();

private slots:

    void on_SerialButton_clicked();

    void on_SendButton_clicked();

    void on_RecvClearButton_clicked();

    void on_SendClearButton_clicked();

    void onTimerTimeout();

    void handleSerialError(QSerialPort::SerialPortError error);
    void on_SerialButton_2_clicked();

    void on_SpeedcomboBox_activated(const QString &arg1);

    void newConnection_slot();
    void readyRead_slot();

private:
    Ui::MainWindow *ui;
    QSerialPort* serial;
    QTimer *timer;
    QString W,A,S,D;
    int speed;
    QMediaPlayer *player;
    QTcpServer *tcpServer;
    QTcpSocket *tcpSocket;
};
#endif // MAINWINDOW_H
